//
//  SIXSelectorViewController.m
//  FastDoctor_6
//
//  Created by mac on 16/3/1.
//  Copyright © 2016年 cool. All rights reserved.
//

#import "SIXSelectorViewController.h"
#import "UIBarButtonItem+Extension.h"

@interface SIXSelectorViewController ()

@property (weak, nonatomic) IBOutlet UILabel *diseaseStyleLabel;

@property (weak, nonatomic) IBOutlet UIImageView *ImageViewOne;

@property (weak, nonatomic) IBOutlet UIImageView *imageViewTwo;

@property (weak, nonatomic) IBOutlet UIButton *sureTreatBtn;

@property (weak, nonatomic) IBOutlet UIButton *likeDiseaseBtn;

@property (weak, nonatomic) IBOutlet UIButton *receiveBtn;

@property (weak, nonatomic) IBOutlet UIButton *unReceiveBtn;

@property (weak, nonatomic) IBOutlet UILabel *numOfDoctorLabel;

@property (weak, nonatomic) IBOutlet UILabel *sureTreatLabel;

@property (weak, nonatomic) IBOutlet UILabel *likeDiseaseLabel;

@property (weak, nonatomic) IBOutlet UILabel *receiveLabel;

@property (weak, nonatomic) IBOutlet UILabel *unReceiveLabel;

@property (weak, nonatomic) IBOutlet UIView *likeVeiw;

@property (weak, nonatomic) IBOutlet UIView *viewOne;

@property (weak, nonatomic) IBOutlet UIView *viewTwo;

@property (weak, nonatomic) IBOutlet UIView *receiveVeiw;

@property (weak, nonatomic) IBOutlet UIButton *applicationBtn;




@end

@implementation SIXSelectorViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setupUI];
    
   
}
-(void)setupUI{

    //设置疾病类型*********************************diseaseStyleLabel要改值
    
    self.diseaseStyleLabel.text = @"疾病类型:";
    
    //设置圆角
    NSArray *array = @[self.viewOne,self.viewTwo,self.likeVeiw,self.receiveVeiw,self.applicationBtn];
    
    [self setRadius:array];
    
    self.ImageViewOne.image = [UIImage imageNamed:@"illness_button_input_blue.png"];
    self.imageViewTwo.image = [UIImage imageNamed:@"illness_button_input_blue.png"];
    
    [self setButton:self.viewOne addTarget:self action:@selector(selectDetailDiseaseMessageClick)];
    [self setButton:self.viewTwo addTarget:self action:@selector(selectMoreDiaease)];
    
    //设置下划线
    NSArray *labelArray = @[self.sureTreatLabel,self.likeDiseaseLabel,self.receiveLabel,self.unReceiveLabel];
    
    [self setLabelUnderLine:labelArray];
    
    //设置导航栏
    [self setupNavBar];
    
    
}

//设置下划线
-(void)setLabelUnderLine:(NSArray *)Labelarray{
    
    for (int i = 0; i < Labelarray.count; i++) {
        
        UILabel *lab = Labelarray[i];
        NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:lab.text];
        NSRange strRange = {0,[str length]};
        [str addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:strRange];
        
        lab.attributedText = str;
        
    }
}

//设置导航栏
-(void)setupNavBar{

    UILabel *lab = [[UILabel alloc]init];
    lab.text = @"疾病详情选择";
    lab.textColor = [UIColor whiteColor];
    self.navigationItem.titleView = lab;
    [lab sizeToFit];
    
    self.navigationItem.leftBarButtonItem = [UIBarButtonItem setupNavBarBtnWithImageName:@"product_button_back_nor.png"];
    
    self.navigationItem.rightBarButtonItem = [UIBarButtonItem setupNavBarBtnWithTitle:@"预约须知" andTarget:self action:@selector(readMe)];
}


-(void)readMe{

    NSLog(@"readMe");
}


//选择疾病细分
-(void)selectDetailDiseaseMessageClick{

    NSLog(@"细分");


}

//选择并发症
-(void)selectMoreDiaease{

    NSLog(@"并发症");
}

-(void)setButton:(UIView *)view addTarget:(id)target action:(SEL)action{

    UIButton *btn = [[UIButton alloc]initWithFrame:view.frame];
    [btn setAlpha:1];
    
    [btn setBackgroundColor:[UIColor clearColor]];
    
    [self.view addSubview:btn];
    
    [btn addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
}



//设置圆角
-(void)setRadius:(NSArray *)array{

    for (int i = 0; i < array.count; i++) {
        UIView *view = array[i];
        view.layer.cornerRadius = 4;
        view.layer.masksToBounds = YES;
    }
}

//确诊按钮点击
- (IBAction)sureTreatBtnClick:(id)sender {
    self.sureTreatBtn.selected = !self.sureTreatBtn.selected;
    if (self.sureTreatBtn.selected) {
        
        self.likeDiseaseBtn.selected = NO;
        
    }
}
//症状疑似按钮点击
- (IBAction)likeDiseaseBtnClick:(id)sender {
    self.likeDiseaseBtn.selected = ! self.likeDiseaseBtn.selected;
    if (self.likeDiseaseBtn.selected) {

    self.sureTreatBtn.selected = NO;
        
    }
}

//接受过按钮点击
- (IBAction)receiveBtnClick:(id)sender {
    self.receiveBtn.selected = ! self.receiveBtn.selected;
    if (self.receiveBtn.selected) {
        
        self.unReceiveBtn.selected = NO;
    }
}

//未接受过按钮点击
- (IBAction)unReceiveBtnClick:(id)sender {
    self.unReceiveBtn.selected = !self.unReceiveBtn.selected;
    if (self.unReceiveBtn.selected) {
        
        self.receiveBtn.selected = NO;
        
    }
}

//就诊申请
- (IBAction)applicationDoctorBtnClick:(id)sender {
    
    
}





- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
